package com.dsjy.yf.address.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsjy.yf.address.entity.dataobject.TownDO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author whj
 * @version 1.0
 * @date 2021-01-14 14:56
 */
public interface TownMapper extends BaseMapper<TownDO> {
    /**
     * 通过区县码获取对应区县下乡镇街道信息
     *
     * @param countyCode
     * @return
     */
    List<TownDO> searchByCountyCode(Integer countyCode);

    /**
     * 获取所有乡镇街道码、乡镇街道名
     *
     * @return
     */
    List<TownDO> searchAll();

    /**
     * 通过乡镇街道码获取对应乡镇街道名
     *
     * @param townCode
     * @return
     */
    String searchByTownCode(Integer townCode);

    /**
     * 查询相应区县街道编码最大值
     *
     * @param parentCode
     * @return
     */
    Integer serchMaxTownCode(Integer parentCode);

    /**
     * 新增数据
     *
     * @param townDO
     * @return
     */
    Integer addTown(@Param("townDO") TownDO townDO);


    /**
     * 更新修改
     *
     * @param townDO
     * @return
     */
    Integer updTown(@Param("townDO") TownDO townDO);
}
